﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace lcmyjobs.Web.findjobs
{
    public partial class StudentsSearch : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                this.Title = string.Format("{1}找工作&bull;校园招聘首页   {1}人才网   {1}招聘网   {1}求职网   {1}猎头网  {0}", Application["webname"].ToString(), Application["webregion"].ToString());
                int id = int.Parse(Application["webid"].ToString());
                BindAscx();
                getcout(id);
                lcmyjobs.BLL.adverts ad = new BLL.adverts();
                DataSet ds = ad.GetAdvnid(31, 48);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count == 18)
                    {
                        for (int i = 1; i < 19; i++)
                        {
                            HyperLink hl = Page.FindControl("HyperLink" + i.ToString()) as HyperLink;
                            hl.ImageUrl = "~" + ds.Tables[0].Rows[i - 1][0].ToString();
                            hl.NavigateUrl = ds.Tables[0].Rows[i - 1][1].ToString();
                            hl.Text = "";
                        }

                    }

                }

                BindLtr();


            }
        }
        protected void getcout(int atid)
        {
            int count = 0;
            lcmyjobs.BLL.user_basic bub = new BLL.user_basic();
            DataSet ds = bub.PageUserSchool(atid, 1, 10, out count);
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();

        }

        private void BindAscx()
        {
            this.News_jyzd.count = 6;
            this.News_jyzd.typeid = 3;
            this.News_jyzd.linkname = "更多就业指导资讯";
            this.News_jyzd.linkurl = "../article-ntid-" + 3 + ".html";
            this.News_jyzd.infourl = "../article";
            this.News_jyzd.para = "-" + 3;


            this.News_zpmsg.count = 6;
            this.News_zpmsg.typeid = 5;
            this.News_zpmsg.linkname = "更多招聘面试官资讯";
            this.News_zpmsg.linkurl = "../article-ntid-" + 5 + ".html";
            this.News_zpmsg.infourl = "../article";
            this.News_zpmsg.para = "-" + 5;

            this.GridJobs1.cells = new string[5] { "招聘职位", "招聘单位", "工作地区", "最低学历", "刷新时间" };
            this.GridJobs1.isShowAspNetPager = false;
            this.GridJobs1.condition = "workerclass";
            this.GridJobs1.value = "2";


        }

        private void BindLtr()
        { 
            //DataSet ds_jyzd = new lcmyjobs.BLL.news().GetListNews(Convert.ToInt32(Application["webid"].ToString()), 20, 6);//
            DataSet ds_jyzd = new lcmyjobs.BLL.news().GetListNews(Convert.ToInt32(Application["webid"].ToString()), 10, 6);//


            if (ds_jyzd.Tables[0].Rows.Count > 0)
            {
                StringBuilder str = new StringBuilder();

                str.Append("<ul  class='vpzp_xx'>");

                foreach (DataRow row in ds_jyzd.Tables[0].Rows)
                {
                    string content = lcmyjobs.BLL.Tools.GetStrSub(row["ntitle"].ToString(),21);
                    str.Append("<li><a target='_blank' href='../article-" + row["nid"] + "-6.html '>" + content + "</a></li>");
                }

                str.Append("</ul>");

                this.ltr_newsList.Text = str.ToString();

            }
        
        }
    }
}